﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using XLua;

public delegate void CustomCall();

public delegate object CustomCall2(object a);

[CSharpCallLua]
public delegate object CustomCall3(out int b,out object c);

public class Lesson5_Function : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        LuaMgr.GetInstance().Init();
        LuaMgr.GetInstance().DoLuaFile("Main");

        CustomCall call = LuaMgr.GetInstance().Global.Get<CustomCall>("testFunc");
        call();
        UnityAction ua=LuaMgr.GetInstance().Global.Get<UnityAction>("testFunc");
        ua();

        
        CustomCall2 call2 = LuaMgr.GetInstance().Global.Get<CustomCall2>("testFunc2");
        var output=call2("youcan");
        Debug.Log("output"+output);
        
        CustomCall3 call3 = LuaMgr.GetInstance().Global.Get<CustomCall3>("testFunc3");
        int b;
        object c;
        var a=call3(out b,out c);
        Debug.Log(a+"____"+b+"____"+c);
         
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
